import Vue from 'vue'
import vuex from 'vuex'
import classobj from './modules/class'
import user from './modules/user'
import getsum from './modules/getsum'
import getbook from './modules/getbook'
Vue.use(vuex)
const store = new vuex.Store({
    state: {
        uname:'mary',
        // name: 'tom',
        // userInfo: {
        //     name: 'tom',
        //     skills: ['抖音', 'B站', '美团'],
        //     address: '武汉黑马',
        //     logo: 'https://vuejs.org/images/logo.svg'
        //     //  https://www.runoob.com/wp-content/uploads/2016/02/react.png
        // },
        // books: [
        //     {
        //       "name": "javasript技术内幕",
        //       "price": 100,
        //       "img": "https://img3m7.ddimg.cn/64/26/29120617-1_u_8.jpg"
        //     },
        //     {
        //       "name": "数学之美",
        //       "price": 44,
        //       "img": "https://img3m2.ddimg.cn/18/30/28538352-1_b_5.jpg"
        //     },
        //     {
        //       "name": "认知天性",
        //       "price": 40,
        //       "img": "https://img3m3.ddimg.cn/74/33/1732997153-3_u_3.jpg"
        //     }
        //   ],
        // Books: []
    },
    mutations: {
        // changelogo(state, { newlogo, newname }) {
        //     state.userInfo.logo = newlogo
        //     state.name = newname
        // },
        // getBooks(state, newBooks) {
        //     state.Books = newBooks
        // }

    },
    getters: {
        // sum(state) {
        //     return state.books.reduce((totol, obj) => totol += obj.price, 0)
        // }
    },
    actions: {
        // async AgetBooks(context) {
        //     const res = await axios({
        //         url: "https://www.fastmock.site/mock/37d3b9f13a48d528a9339fbed1b81bd5/book/api/books"
        //     })
        //     // console.log(res);
        //     context.commit('getBooks', res.data.data)
        // }
    },
    modules: {
        classobj,
        user,
        getsum,
        getbook
    }
})
export default store
